/**
 * @param {number[]} security
 * @param {number} time
 * @return {number[]}
 */
 var goodDaysToRobBank = function(security, time) {
  if(time === 0) return security.map((v,i) => i)
  let ans = []
  const check = (idx, k) => {
    let pre = security[idx-k]
    for(let i = idx-k+1; i<=idx; i++){
      if(security[i] > pre){
        return false
      }
      pre = security[i]
    }
    pre = security[idx]
    for(let i = idx+1; i<=idx+k; i++){
      if(security[i] < pre){
        return false
      }
      pre = security[i]
    }
    return true
  }
  for(let i = time; i<security.length-time; i++){
    if(check(i, time)){
      ans.push(i)
    }
  }
  return ans
};